/**
 * created at 02.09.2008, 17:10:48
 */
package de.jmda.core.util.jpa;

import javax.lang.model.element.VariableElement;

/**
 * Abstract base class for classes that provide information about unidirectional
 * entity relations.
 *
 *
 */
public abstract class EntityRelationInfoUnidirectional
extends EntityRelationInfo
{
	protected EntityRelationInfoUnidirectional(
			EntityRelation entityRelation, VariableElement declaredField)
	{
		super(entityRelation, declaredField);
	}

	/**
	 * According to JSR-220 (EJB 3.0 specification) JPA, chapter 2.1.7 every
	 * <b>unidirectional</b> entity relation has an owning (but no inverse) side.
	 * The owning side declaredField declaration is {@link
	 * EntityRelationInfoUnidirectional#declaredField}.
	 */
	@Override
	public VariableElement getOwningField()
	{
		// there is no other declaredField declaration in an unidirectional entity relation
		return declaredField;
	}

	/**
	 * @see de.jmda.core.util.jpa.EntityRelationInfo#toString()
	 */
	@Override
	public String toString()
	{
		return
				super.toString() + "\n" +
				"owning declaredField   [" + declaredField.asType() + "." +
				declaredField.getSimpleName() + "]";
	}
}